#ifndef WALKAWARE_SERVICES_SERVICETHREAD_H
#define WALKAWARE_SERVICES_SERVICETHREAD_H

#include <assert.h>

#include <QThread>

#include <WalkaWare/Services/Detail/RunnableService.h>

namespace WalkaWare
{

namespace Services
{

namespace Detail
{

class ServiceThread : public QThread
{
	Q_OBJECT

	public:

		typedef QThread       BaseType;
		typedef ServiceThread ThisType;

		ServiceThread(RunnableService * rservice)
			: BaseType (0)
			, service  (rservice)
		{
			assert(rservice != 0);
		}

	protected:

		RunnableService * service;

		virtual void run(void)
		{
			assert(this->service != 0);
			this->service->run();
		}
};

} // end namespace Detail

} // end namespace Services

} // end namespace WalkaWare

#endif // WALKAWARE_SERVICES_SERVICETHREAD_H
